package com.krause.marinechart;

import java.io.File;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.krause.marinechart.iso8211.Module;

public class MarineChartActivity extends Activity {
	
	private ProgressBar pBar;
	private TextView tv;
	
	private Module mModule;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        pBar = (ProgressBar) findViewById(R.id.progressBar);
        tv = (TextView) findViewById(R.id.text);
    }
    
    @Override
    protected void onResume() {
    	// TODO Auto-generated method stub
    	super.onResume();
        
        File file = new File("/sdcard/Download/US5SC14M.000");
        pBar.setMax((int) file.length());
        mModule = new Module(pBar, tv);
        mModule.execute(file);
        Log.d("DONE", "Started executing");
    }
    
    @Override
    protected void onPause() {
    	// TODO Auto-generated method stub
    	super.onPause();
    	mModule.cancel(true);
    }
}